/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
 * assign4
 * Copyright (C)  Michael 2008 <mikey.morckos@gmail.com>
 * 
 * assign4 is free software: you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * assign4 is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License along
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef _IMGWRAPPER_H_
#define _IMGWRAPPER_H_

#include <opencv/cv.h>
#include <opencv/highgui.h>

/* WRAPPER FOR EXTRACTING IMAGE DATA */
template <class T> class IMG {
	
	public:
        IMG(IplImage* img = 0) {

			imgp = img;
		}
		
        ~IMG() {
			imgp = 0;
		}
		
		inline void set_IMG(IplImage* img) {

			imgp = img;
		}	
        
		inline void operator=(IplImage* img) {

			imgp = img;
		}
		
        inline T* operator[](const int rowIndx) {

			return ((T *)(imgp->imageData + rowIndx*imgp->widthStep));
		}
	
    private:
        IplImage* imgp;
};

class RgbPixel {

	public:
	    unsigned char b, g, r;
};

typedef IMG <RgbPixel>  MY_Image;

#endif // _IMGWRAPPER_H_

